<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" id="i1">
<input type="text" id="i2">
<input type="button" value="加" onclick="fn1()">
<input type="button" value="减" onclick="fn2()">
<input type="button" value="乘" onclick="fn3()">
<input type="button" value="除" onclick="fn4()">
<div>结果:0</div>
<script>
    function fn1() {
        let i1 = document.querySelector("#i1");
        let i2 = document.querySelector("#i2");
        let d = document.querySelector("div");
        d.innerText = "结果:"+(i1.value*1+i2.value*1);
    }
    function fn2() {
        let i1 = document.querySelector("#i1");
        let i2 = document.querySelector("#i2");
        let d = document.querySelector("div");
        d.innerText = "结果:"+(i1.value*1-i2.value*1);
    }
    function fn3() {
        let i1 = document.querySelector("#i1");
        let i2 = document.querySelector("#i2");
        let d = document.querySelector("div");
        d.innerText = "结果:"+(i1.value*1*i2.value*1);
    }
    function fn4() {
        let i1 = document.querySelector("#i1");
        let i2 = document.querySelector("#i2");
        let d = document.querySelector("div");
        d.innerText = "结果:"+(i1.value*1/i2.value*1);
    }
</script>
</body>
</html>